package com.itheima.app.controller;

import com.itheima.app.manager.SoundManager;
import com.itheima.domain.vo.SoundVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import java.io.IOException;

@RestController
public class SoundController {

    @Autowired
    private SoundManager soundManager;

    //发送语音
    @PostMapping("/peachblossom")
    public void saveSound(MultipartFile soundFile)throws IOException {
        // 调用manager保存语音
        soundManager.saveSound(soundFile);
    }

    //接收语音
    @GetMapping("/peachblossom")
    public SoundVo getSound() {

        // 直接调用manager查询语音
        SoundVo soundVo = soundManager.getSound();

        return soundVo;

    }


}
